#include <iostream>
#include <numeric>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int* nums=new int[n+1];
    for (int i=1;i<=n;i++)
    {
        if (i==1)
            nums[1]=1;
        else
            nums[i]=i*nums[i-1];
    }
    int sum=accumulate(nums+1,nums+n+1,0);
    cout<<sum;
}